<template>
  <div class="like">
    <div class="list-item">
      <header>
        <span>猜你喜欢</span>
      </header>
      <ul>
        <li v-for="item in likeList" :key="item.id" @click="goPath(item.id)"> 
          <img
            :src="item.imgUrl"
            alt=""
          />
          <div class="item-title">
            <div class="name">{{item.title}}</div>
            <div class="price">
              <span>￥</span>
              <b>{{item.price}}</b>
            </div>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
    props:['likeList'],
    methods: {
      goPath(id) {
        this.$router.push({
          name:'details',
          params: {
            id,
          }
        })
      }
    }
};
</script>

<style lang="less" scoped>
.like {
  .list-item {
    header {
      padding: 0.4688rem 0;
      text-align: center;
      span {
        position: relative;
        text-align: center;
        font-size: 1.125rem;

        color: #333333;
      }
      span::after,
      span::before {
        content: "";
        position: absolute;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #d4c0a7;
        top: 50%;
        margin-top: -4px;
      }
      span::after {
        right: -20px;
      }
      span::before {
        left: -20px;
      }
    }
    ul {
      padding: 0.2344rem;
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      li {
        width: 50%;
        padding: 0.2344rem;
        box-sizing: border-box;
        margin-bottom: 0.9375rem;
        img {
          width: 100%;
          background: #f3f3f3;
        }
        .item-title {
          .name {
            font-size: 0.9375rem;
            padding: 8px 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }
          .price {
            text-align: left;
            color: #b0352f;
            span {
              font-size: 0.75rem;
            }
          }
        }
      }
    }
  }
}
</style>